<% 
<!-- Raw data process-->
    var tweetClass = "";
    switch (refav){
        case "1" : tweetClass = "retweeted";
            break;
        case "10" : tweetClass = "favorited";
            break;
        case "11" : tweetClass = "retweeted favorited";
            break
    }
    var myTweet = false;
    if ( currentUserID == user_id){
        myTweet = true;
        tweetClass += " my-tweet";
    }
    
    <!-- Check if have image in post -->
    <!-- Check if have image in post -->
    var isHaveImg = false;
    reg = content.match("http://?.*\w*\.(jpg|jpeg|png|gif)"); 
    if ( reg ){
        isHaveImg = true;
        image     = reg[0];
    }
        
    <!-- format date -->
    var reggie = /(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/g;
    var dateArray = reggie.exec(created_time); 
    var dateObject = new Date(
        (+dateArray[1]),
        (+dateArray[2])-1, // Careful, month starts at 0!
        (+dateArray[3]),
        (+dateArray[4]),
        (+dateArray[5]),
        (+dateArray[6])
    );
    reggie.lastIndex = 0;        
%>

<div class="stream-item expanding-stream-item open" style="margin-top: 8px; margin-bottom: 8px; ">
    <div class="expansion-container" style="height: auto; ">
        <div class="tweet original-tweet <%= tweetClass%> opened-tweet">
            <i class="dogear"></i>
            <div class="content">
                <div class="stream-item-header">
                    <small class="time">
                        <a href="status/<%= username %>" class="tweet-timestamp" title="<%=dateObject.toISOString()%>"><span title="<%=dateObject.toISOString()%>" class="_timestamp">7h</span></a>
                    </small>
                    <a class="account-group" href="user/<%= username %>">
                        <img class="avatar" src="<%= avatar %>" alt="<%= username %>">
                        <strong class="fullname"><%= full_name %></strong>
                        <span>‏</span><span class="username"><s>@</s><b><%= username %></b></span>
                    </a>
                </div>

                <p class="js-tweet-text">
                    <%= content %>
                </p>
                <div class="stream-item-footer">
                    <div class="context">
                        <% if (retweeted_by != "") {%>
                        <span class="with-icn">
                            <i class="badge-retweeted"></i>
                            <span class="js-retweet-text">Retweeted by 
                                <a class="pretty-link" href="luckymancvp" data-user-id="83644624">
                                    <b>Dang Thanh Tu</b>
                                </a>
                            </span>
                        </span>
                        <%}%>
                    </div>


                    <a class="details with-icn" href="fireheron/status/230886971264868353">
                        <span class="details-icon">
                        </span>
                        <b>
                            <span class="expand-stream-item js-view-details">
                                <span class="expand-action-wrapper">
                                    Expand
                                </span>
                            </span>
                            <span class="collapse-stream-item js-hide-details">
                                <span class="collapse-action-wrapper">
                                    Collapse
                                </span>
                            </span>
                        </b>
                    </a>


                    <ul class="tweet-actions">
                        <li class="action-reply-container">
                            <a class="with-icn" data-modal="tweet-reply" href="#" title="Reply">
                                <i class="sm-reply"></i>
                                <b>Reply</b>
                            </a>
                        </li>
                        <li class="action-rt-container">
                            <a class="with-icn" data-modal="tweet-retweet" href="#">
                                <i class="sm-rt"></i>
                                <b>
                                    <span class="undo-retweet" title="Undo retweet">Retweeted</span>
                                    <span class="retweet" title="Retweet">Retweet</span>
                                </b>
                            </a>
                        </li>
                        <li class="action-del-container">
                            <a class="with-icn" href="#" title="Delete">
                                <i class="sm-trash"></i>
                                <b>Delete</b>
                            </a>
                        </li>
                        <li class="action-fav-container">
                            <a class="with-icn" href="#">
                                <i class="sm-fav"></i>
                                <b>
                                    <span class="unfavorite" title="Undo favorite">Favorited</span>
                                    <span class="favorite" title="Favorite">Favorite</span>
                                </b>
                            </a>
                        </li>
                    </ul>      
                </div>


                <div class="expanded-content">
                    <div class="tweet-details-fixer">
                        <div >
                            <div class="component" data-component-term="media">
                                <%if (isHaveImg){%>
                                <!-- Tweet media here -->
                                <br>
                                <div class="tweet-media">
                                    <div data-media-type="nativePhoto" data-url-id="http://t.co/0rY4T7hF" class="media-instance-container nativephoto-container"><div class="cards-base cards-multimedia" data-card-type="photo" data-card-url="//twitter.com/m_nemu/status/240467412212908032/photo/1/large">
                                            <div class="media">
                                                <a href="//twitter.com/m_nemu/status/240467412212908032/photo/1/large" class="twitter-timeline-link">
                                                    <img width="350"alt="Embedded image permalink" src="<%= image%>">
                                                </a>
                                            </div>
                                            <div class="cards-content">

                                                <div class="byline">


                                                    <span class="pb-attribution">
                                                        Powered by <a href="http://photobucket.com/twitter" class="with-icn" target="_blank"><i class="service-sm-native-photobucket"></i>Photobucket</a>
                                                    </span>
                                                </div>

                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <%}%>
                            </div>
                        </div>
                        <div class="">
                            <div class="component"></div>
                        </div>
                        <div class="tweet-stats-container already-open" style="">
                            <div class="component" data-component-term="tweet_stats">
                                <ul class="stats no-activity-popup">
                                    <li class="stat-count">
                                        <a>
                                            <strong><%=more.countRet%></strong> Retweet
                                        </a>
                                    </li>
                                    <li class="stat-count">
                                        <a>
                                            <strong><%=more.countFav%></strong> Favorite
                                        </a>
                                    </li>
                                    <li class="avatar-row">
                                        <% for(i in more.users){ user = more.users[i];%>
                                        <a href="<%=user.username%>" original-title="<%=user.full_name%>">
                                            <img class="avatar size24" src="<%=user.avatar%>" alt="<%=user.full_name%>" title="<%=user.full_name%>">
                                        </a>
                                        <%}%>
                                    </li>
                                </ul>
                            </div>
                        </div>

                        <div class="client-and-actions">
                            <span class="metadata">
                                <span title="<%=dateObject.toISOString()%>"><%=created_time%> </span>

                                <span class="tweet-source">via web</span>

                                · <a class="permalink-link js-permalink" href="fireheron/status/<%=tweet_id%>">Details</a>

                            </span>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>